package com.vernon.demo.model;

/**
 * @Auther: vernon
 * @Date: 2021/4/26 23:07
 * @Description:
 */
public class Result<T> {
    private T data;
    private String msg;
    private Integer code;
    private boolean success;

    public static Result success(Object data) {
        Result result = new Result();
        result.setData(data);
        result.setSuccess(true);
        result.setCode(200);
        return result;
    }

    public static Result error(String msg) {
        Result result = new Result();
        result.setSuccess(false);
        result.setMsg(msg);
        result.setCode(500);
        return result;
    }


    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }
}
